package batframework.log;

import batframework.code.util.ClassUtils;

/***
 * The five logging levels used by Log are (in order):
 * 1. DEBUG (the least serious)
 * 2. INFO
 * 3. WARN
 * 4. ERROR
 * 5. FATAL (the most serious)
 * @author bmyues
 *
 */
public abstract class Logger
{
	private static Class<?> logClass;
	
	static{
		if(ClassUtils.forName("org.apache.log4j.Logger") != null)
			 logClass = Log4jLogger.class;
		logClass = JdkLogger.class;
	}
	
	private static Logger logger()
	{
		return ClassUtils.createObject(logClass);
	}
	
	public static Logger getLogger(Class<?> clazz)
	{
		Logger logger = logger();
		logger.initLogger(clazz);
		return logger;
	}
	
	public static Logger getLogger(String clazz)
	{
		Logger logger = logger();
		logger.initLogger(clazz);
		return logger;
	}
		
	public abstract void initLogger(Class<?> clazz);
	 
	public abstract void initLogger(String clazz);
	
	public abstract void info(String message);
		
	 public abstract void info(String message, Throwable t);
	
	 public abstract void debug(String message);
	
	 public abstract void debug(String message, Throwable t);
	
	 public abstract void warn(String message);
	
	 public abstract void warn(String message, Throwable t);
	
	 public abstract void error(String message);
	
	 public abstract void error(String message, Throwable t);
	
	 public abstract void fatal(String message);
	
	 public abstract void fatal(String message, Throwable t);
	 
	 public abstract boolean isDebugEnabled();

	public abstract boolean isInfoEnabled();

	public abstract boolean isWarnEnabled();

	public abstract boolean isErrorEnabled();
	
	public abstract boolean isFatalEnabled();
 
}
